import request from '@/utils/request'
import { AxiosPromise } from 'axios'

// apiUrl 采购订单管理
const api = {
	page: '/v1/purchase-order/page',
	create: '/v1/purchase-order/create',
	update: '/v1/purchase-order/update',
	delete: '/v1/purchase-order/delete',
	launch: '/v1/purchase-order/launch'
}

/**
 * 采购订单管理 - 列表
 */
function postPageApi(data: any): AxiosPromise {
	return request({
		url: api.page,
		method: 'post',
		data
	})
}

/**
 * 采购订单管理 - 新增编辑保存
 */
function postAddOrEditSaveApi(data: any): AxiosPromise {
	return request({
		url: data.id ? api.update : api.create,
		method: 'post',
		data
	})
}

/**
 * 采购订单管理 - 删除
 */
function postDeleteApi(data: any): AxiosPromise {
	return request({
		url: api.delete,
		method: 'post',
		data
	})
}

/**
 * 采购订单管理 - 删除
 */
function postlaunchApi(data: any): AxiosPromise {
	return request({
		url: api.launch,
		method: 'post',
		data
	})
}
export default {
	postPageApi,
	postAddOrEditSaveApi,
	postDeleteApi,
	postlaunchApi
}
